#ifndef BUFFER_H
#define BUFFER_H

#include <QMutex>
#include <QObject>
#include <QSemaphore>
#include <QString>
#include <QLabel>
#include <QFile>
#include <QTextStream>
#include <cstdio>
class Buffer : public QObject
{
    Q_OBJECT

public:
                int bufferSize,posicaoEscreve,posicaoLe,totalProdutos,countLabelacao,totalProdutosPraLeitura;
		QSemaphore * semaforoUsados;
		QSemaphore * semaforoLivres;
                //QSemaphore * multiplasLeituras;
                QMutex	* mutex;
                QMutex  * mutex2;
                QMutex  * mutex3;
                int * vetor;
                int totalLeitoresRodada;
                int leiturasMultiplas;

                //FILE * printer;
                int countLabelSemaforos;
                QLabel * labelSaida;
                QLabel * labelSemaforos;



explicit Buffer(QObject *parent = 0);
                Buffer(int,int);
                int le();
                int le(int i);
                int escreve(int);
                void showStatus();
 //               void setLabelSaida(QLabel *);
//                void setSaidaDoLabel(QString);
                void setLabelSemaphoros(QLabel *);
                void setSaidaDoLabelSemaforos(QString);
signals:
                void mudouBuffer(int * buffer,int posicaoEscrita,QMutex *);
                void leuBuffer(int * buffer,int posicaoLeitura,QMutex *);
public slots:

};

#endif // BUFFER_H
